home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / dnssd / query.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.5 KB  |  104 lines

  1. /* This file is part of the KDE project
  2.  *
  3.  * Copyright (C) 2004 Jakub Stachowski <qbast@go2.pl>
  4.  *
  5.  * This library is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU Library General Public
  7.  * License as published by the Free Software Foundation; either
  8.  * version 2 of the License, or (at your option) any later version.
  9.  *
  10.  * This library is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * Library General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU Library General Public License
  16.  * along with this library; see the file COPYING.LIB.  If not, write to
  17.  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.  * Boston, MA 02110-1301, USA.
  19.  */
  20.  
  21. #ifndef DNSSDQUERY_H
  22. #define DNSSDQUERY_H
  23.  
  24. #include <qobject.h>
  25. #include <dnssd/remoteservice.h>
  26.  
  27.  
  28. namespace DNSSD
  29. {
  30. class QueryPrivate;
  31.  
  32. /**
  33. This class provides way to search for specified service type in one domain. Depending on domain
  34. name, either multicast or unicast DNS will be used.
  35.  
  36. @short Class that represents service query in one domain.
  37. @author Jakub Stachowski
  38.  */
  39. class KDNSSD_EXPORT Query : public QObject
  40. {
  41.     Q_OBJECT
  42. public:
  43.     /**
  44.     Creates new query. 
  45.  
  46.     @param type Type of services to browse for
  47.     @param domain Domain name - if set to "local." multicast query will be performed,
  48.             otherwise unicast
  49.      */
  50.     Query(const QString& type, const QString& domain);
  51.  
  52.     virtual ~Query();
  53.  
  54.     /**
  55.     Starts query. Ignored if query is already running
  56.      */
  57.     virtual void startQuery();
  58.  
  59.     /**
  60.     Returns TRUE if query is already running
  61.      */
  62.     bool isRunning() const;
  63.  
  64.     /**
  65.     Returns TRUE if all currently announced services has
  66.     been reported. It does not mean that no more services can
  67.     be found later and it is not related to isRunning()
  68.      */
  69.     bool isFinished() const;
  70.  
  71.     /**
  72.     Returns queried domain
  73.      */
  74.     const QString& domain() const;
  75.  
  76. signals:
  77.     /**
  78.     Emitted when new service has been discovered
  79.      */
  80.     void serviceAdded(DNSSD::RemoteService::Ptr);
  81.  
  82.     /**
  83.     Emitted when previously discovered service is not longer published
  84.      */
  85.     void serviceRemoved(DNSSD::RemoteService::Ptr);
  86.  
  87.     /**
  88.     Emitted when all announced services has been reported. 
  89.      */
  90.     void finished();
  91.  
  92. protected:
  93.     virtual void virtual_hook(int, void*);
  94.     virtual void customEvent(QCustomEvent* event);
  95. private:
  96.     QueryPrivate *d;
  97. private slots:
  98.     void timeout();
  99. };
  100.  
  101. }
  102.  
  103. #endif
  104.